﻿namespace clowncar.Utils
{
    using System;
    using System.IO;
    using System.Reflection;

    internal static class IOUtils
    {

        public static void ConsoleError(string message, Exception ex)
        {
            Console.ForegroundColor = ConsoleColor.Red;
            Console.Write(message);

            Console.ResetColor();
            if (ex != null)
            {
                Console.Write(": ");
                Console.WriteLine(ex.Message);
#if DEBUG
                Console.WriteLine(ex.ToString());
                //Console.ReadLine();
#endif
            }
            else
            {
                Console.WriteLine();
            }

            Console.ForegroundColor = ConsoleColor.Green;
            Console.WriteLine(String.Format("Try '{0} --help' for more information.", Path.GetFileNameWithoutExtension(Assembly.GetEntryAssembly().Location)));
            Console.ResetColor();
        }
    }
}
